<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1" />
<title>Yahoo! Messenger Plugin Example - Secondary Window</title>
<style type="text/css">
</style>
<script type="text/javascript">

// Hi there. Welcome to the Yahoo! Instant Messenger Plugin Demo.
// A decent knowledge of Javascript and general web development is a prerequisite for
// understanding this demo. I can tell you're excited already, so let's jump right in.

// an onLoad function is something I recommended for all plugins
function onLoad() {

    // the window.external object gives you access to the Yahoo! Messenger Plugin SDK
    // I like to name it something short, like y, for easy access
    y = window.external;

    // calls a function which i've named onMainPluginWindowMessage whenever event MainPluginWindowMessage is fired
    y.SetEventHandler("MainPluginWindowMessage", onMainPluginWindowMessage);

    // function to handle the onMainPluginWindowMessage event
    function onMainPluginWindowMessage(msg) {
        // creates a textNode within messageReceiver and places the received msg inside it
        if (!document.getElementById("messageReceiver").childNodes[0]) document.getElementById("messageReceiver").appendChild(document.createTextNode(msg));
        // if a textNode already exists, it simply alters its value with the received msg
        else document.getElementById("messageReceiver").childNodes[0].nodeValue = msg;
    }

    // this tells Yahoo! Messenger that the plugin is ready to begin handling the events for which I've defined handlers for
    y.LocalReady();
}

</script>
</head>
<body onload="onLoad();">

<div id="container">
<div id="messageReceiver"></div>
</div>

</body>
</html>